// src/api/maintenanceRecordApi.js
import http from '../util/request.js';

export default {
    // 获取所有维护记录
    all: (params = {}) => http({
        url: '/api/maintenanceRecord/all',
        method: 'get',
        params,
    }),

    // 分页获取维护记录
    page: (page, params = {}) => http({
        url: '/api/maintenanceRecord/page',
        method: 'get',
        params: { ...params, ...page },
    }),

    // 添加维护记录
    add: (obj) => http({
        url: '/api/maintenanceRecord/add',
        method: 'post',
        data: obj,
        headers: { 'Content-Type': 'application/json' },
    }),

    // 编辑维护记录
    edit: (obj) => http({
        url: '/api/maintenanceRecord/edit',
        method: 'put',
        data: obj,
        headers: { 'Content-Type': 'application/json' },
    }),

    // 删除维护记录
    del: (id) => http({
        url: '/api/maintenanceRecord/del',
        method: 'delete',
        params: { id },
    }),

    // 获取单个维护记录
    one: (id) => http({
        url: '/api/maintenanceRecord/one',
        method: 'get',
        params: { id },
    }),
};
